home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Snippets / Memory / Switch Stack / Switch Stack.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-02  |  1.8 KB  |  87 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        Switch Stack.h
  3.  
  4.     Contains:    A simple example of a VBL written in THINK C that runs on a
  5.                 private stack.
  6.  
  7.     Written by:    Jim Luther (Based on the VBL code from the Technical Note
  8.                 "MultiFinder Miscellanea".) 
  9.  
  10.     Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11.  
  12.     Change History (most recent first):
  13.  
  14.          <2>     10/13/93    JML        Minor cleanup
  15.          <1>     10/08/93    JML        First pass
  16.  
  17. */
  18.  
  19. #ifndef __RETRACE__
  20. #include <Retrace.h>
  21. #endif
  22.  
  23. #ifndef __SYSEQU__
  24. #include <SysEqu.h>
  25. #endif
  26.  
  27. #ifndef __MEMORY__
  28. #include <Memory.h>
  29. #endif
  30.  
  31. #ifndef __OSEVENTS__
  32. #include <OSEvents.h>
  33. #endif
  34.  
  35. #ifndef __FONTS__
  36. #include <Fonts.h>
  37. #endif
  38.  
  39. #ifndef __MENUS__
  40. #include <Menus.h>
  41. #endif
  42.  
  43. #ifndef __DIALOGS__
  44. #include <Dialogs.h>
  45. #endif
  46.  
  47. #ifndef __BDC__
  48. #include <BDC.h>
  49. #endif
  50.  
  51. /*----------------------------------------------------------------------------*/
  52.  
  53. /*
  54. **    Define a struct to keep track of what we need.  Put theVBLTask into the
  55. **    struct first because its address will be passed to our VBL task in A0
  56. */
  57. struct VBLRec {
  58.     VBLTask    theVBLTask;            /* the VBL task itself */
  59.     long    VBLA5;                /* saved CurrentA5 where we can find it */
  60.     Ptr        ourStackBottom;        /* saved stack bottom where we can find it */
  61.     Ptr        ourStackTop;        /* saved stack top where we can find it */
  62.     Ptr        savedA7;            /* place where VBL saves current A7 */
  63.     Ptr        savedStkLowPt;        /* place where VBL saves StkLowPt */
  64.     Ptr        savedHiHeapMark;    /* place where VBL saves HiHeapMark */
  65. };
  66. typedef struct VBLRec VBLRec, *VBLRecPtr;
  67.  
  68. /*----------------------------------------------------------------------------*/
  69.  
  70. #define INTERVAL        6        /* VBL interval */
  71. #define rInfoDialog        140        /* DLOG resource ID */
  72. #define rStatTextItem    1        /* item number of counter field in dialog */
  73.  
  74. #define    kStackSize 0x4000        /* 16K */
  75.  
  76. /*
  77. **    Prototypes
  78. */
  79.  
  80. VBLRecPtr GetVBLRec ();
  81.  
  82. void DoVBL (VBLRecPtr recPtr);
  83.  
  84. void StartVBL ();
  85.  
  86. void main (void);
  87.